<p class="Paragraph"><help:paragraphinfo state="U" number="4" xmlns:help="http://openoffice.org/2000/help"/>You can automatically executing a macro when a specified software event occurs by assigning the desired macro to the event. The following table provides an overview of program events and at what point an assigned macro is executed.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="8" xmlns:help="http://openoffice.org/2000/help"/>... after a <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> application is started.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/>...after a new document is created with <span class="T1">File - New</span> or with the <span class="T1">New</span> icon.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="14" xmlns:help="http://openoffice.org/2000/help"/>...after a document is opened with <span class="T1">File - Open</span> or with the <span class="T1">Open</span> icon.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="16" xmlns:help="http://openoffice.org/2000/help"/>...before a document is saved under a specified name (with <span class="T1">File - Save As</span>, or with <span class="T1">File - Save</span> or the <span class="T1">Save</span> icon, if a document name has not yet been specified).</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="44" xmlns:help="http://openoffice.org/2000/help"/>... after a document was saved under a specified name (with <span class="T1">File - Save As</span>, or with <span class="T1">File - Save</span> or with the <span class="T1">Save</span> icon, if a document name has not yet been specified).</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="18" xmlns:help="http://openoffice.org/2000/help"/>...before a document is saved with <span class="T1">File - Save</span> or the <span class="T1">Save</span> icon, provided that a document name has already been specified.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="46" xmlns:help="http://openoffice.org/2000/help"/>...after a document is saved with <span class="T1">File - Save</span> or the <span class="T1">Save</span> icon, provided that a document name has already been specified.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="48" xmlns:help="http://openoffice.org/2000/help"/>...after a document was closed. Note that the "Save Document" event may also occur when the document is saved before closing.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="22" xmlns:help="http://openoffice.org/2000/help"/>...after a document is brought to the foreground.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="24" xmlns:help="http://openoffice.org/2000/help"/>...after another document is brought to the foreground.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="26" xmlns:help="http://openoffice.org/2000/help"/>...after the <span class="T1">Print</span> dialog is closed, but before the actual print process begins.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="28" xmlns:help="http://openoffice.org/2000/help"/>...after the <span class="T1">Print</span> dialog is closed, but before the actual print process begins. This event occurs for each copy printed.</p>
<p class="Head2"><help:paragraphinfo state="U" number="30" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="macros; assign to events" tag="kw66494_1" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="events; assign to macros" tag="kw66494_3" xmlns:help="http://openoffice.org/2000/help"/>Assigning a Macro to an Event</p>
<ol class="L1">
<li class="">
<p class="P2"><help:paragraphinfo state="U" number="31" xmlns:help="http://openoffice.org/2000/help"/>Choose <span class="T1">Tools - Configure</span> and click the <span class="T1">Events</span> tab.</p>
</li>
<li class="">
<p class="P2"><help:paragraphinfo state="U" number="55" xmlns:help="http://openoffice.org/2000/help"/>Select whether you want the assignment to be globally valid or just valid in the current document by selecting the <span class="T1">StarOffice</span> or <span class="T1">Document</span> option.</p>
</li>
<li class="">
<p class="P2"><help:paragraphinfo state="U" number="32" xmlns:help="http://openoffice.org/2000/help"/>Select the event from the <span class="T1">Event</span> list.</p>
</li>
<li class="">
<p class="P2"><help:paragraphinfo state="U" number="33" xmlns:help="http://openoffice.org/2000/help"/>Select the module containing the macro to be assigned to the selected event from the <span class="T1">Macros</span> list. The list contains a hierarchical list of modules, libaries, files, and templates.</p>
</li>
<li class="">
<p class="P2"><help:paragraphinfo state="U" number="34" xmlns:help="http://openoffice.org/2000/help"/>Select the macro to be assigned from the right list.</p>
<p class="P2"><help:paragraphinfo state="U" number="56" xmlns:help="http://openoffice.org/2000/help"/>Click <span class="T1">OK</span> to close the dialog.</p>
</li>
</ol>
<p class="Head2"><help:paragraphinfo state="U" number="36" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="events; delete macro assignment" tag="kw66494_2" xmlns:help="http://openoffice.org/2000/help"/>Removing the Assignment of a Macro to an Event</p>
<ol class="L2">
<li class="">
<p class="P3"><help:paragraphinfo state="U" number="57" xmlns:help="http://openoffice.org/2000/help"/>Choose <span class="T1">Tools - Configure</span> and click the <span class="T1">Events</span> tab.</p>
</li>
<li class="">
<p class="P3"><help:paragraphinfo state="U" number="58" xmlns:help="http://openoffice.org/2000/help"/>Select whether you want to remove a gobal assignment or an assignment that is just valid in the current document by selecting the <span class="T1">StarOffice</span> or <span class="T1">Document</span> option.</p>
</li>
<li class="">
<p class="P3"><help:paragraphinfo state="U" number="59" xmlns:help="http://openoffice.org/2000/help"/>Select the event that contains the assignment to be removed from the <span class="T1">Event</span> list.</p>
<p class="P3"><help:paragraphinfo state="U" number="60" xmlns:help="http://openoffice.org/2000/help"/>Click <span class="T1">OK</span> to close the dialog.</p>